import React from 'react';
import { Link } from 'react-router-dom';
import { Typography, Button, Alert } from 'antd';
import { 
  ArrowLeftOutlined, 
  SettingOutlined, 
  ReloadOutlined,
  InfoCircleOutlined 
} from '@ant-design/icons';

const { Title, Text } = Typography;

const PageHeader = ({ network, onRefresh, isLoading }) => {
  return (
    <div className="manage-page-header">
      <Link 
        to={`/network/${network.networkId}`}
        className="back-link"
      >
        <ArrowLeftOutlined />
        返回详情
      </Link>
      
      <div className="header-main">
        <div className="header-info">
          <Title level={2}>
            <SettingOutlined style={{ marginRight: 8, color: '#1890ff' }} />
            管理网络: {network.name}
          </Title>
          <Text className="subtitle">配置和管理您的局域网设置</Text>
        </div>
        <Button 
          icon={<ReloadOutlined />}
          onClick={onRefresh}
          loading={isLoading}
          className="refresh-btn"
        >
          刷新数据
        </Button>
      </div>

      {/* 管理员权限提示 */}
      <Alert
        message="管理员权限"
        description="您正在以管理员身份管理此网络。修改网络信息和规则将影响所有网络成员，请谨慎操作。"
        type="info"
        icon={<InfoCircleOutlined />}
        className="admin-alert"
        showIcon
      />
    </div>
  );
};

export default PageHeader;